<template>
	<view class="jobfair-list" v-if="careerList.length">
		<view class="jobfair-item" v-for="item in careerList" :key="item.id" 
			@tap="nologinJump(`/subpage/talentemployment/jobfair/jobfairdetail?id=${item.id}`)">
			<text :class="['jobfair-name', 's_2', statusText(item.progState).class]">{{ item.careerTitle }}</text>
			<view class="jobfair-labels">
				<text class="label">{{ item.companyNumber }}家企业</text>
				<text class="label">{{ item.stationNumber }}个岗位</text>
			</view>
			<view class="jobfair-info">
				<text class="info address">{{ item.hostAddr }}</text>
				<text class="info date">{{ item.meetTime | formatDateTime }}-{{ item.endTime | formatDateTime }}</text>
			</view>
			<text :class="['jobfair-statu', statusText(item.progState).class]">{{ statusText(item.progState).text }}</text>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			dataArray: {
				type: Array,
				default: () => []
			},
		},
		data() {
			return {
				careerList: []
			}
		},
		watch: {
			dataArray: {
				handler(newArr, oldArr) {
					if (newArr && newArr.length) {
						this.careerList = newArr
					}	
				},
				immediate: true
			}
		},
		methods: {
			statusText(type) {
				switch(type) {
					case 0:
						return {
							class: 'start',
							text: '马上开始'
						}
					case 1:
						return {
							class: 'hot',
							text: '正在热招'
						}
					case 2:
						return {
							class: 'end',
							text: '已经结束'
						}
				}
			}
		}
	}
</script>

<style lang="scss">
	.jobfair-list {
		.jobfair-item {
			position: relative;
			width: 100%;
			// height: 300rpx;
			padding: 28rpx 30rpx 24rpx 32rpx;
			margin-bottom: 24rpx;
			background: #FFFFFF;
			border-radius: 20px;
			box-sizing: border-box;
			.jobfair-name {
				// height: 98rpx;
				font-weight: 600;
				font-size: 32rpx;
				color: #34314F;
				line-height: 44rpx;
				text-align: left;
				margin-bottom: 20rpx;
				&.end {
					color: rgba(52, 49, 79, 0.40);
				}
			}
			.jobfair-labels {
				display: flex;
				flex-wrap: nowrap;
				margin-bottom: 24rpx;
				text {
					display: block;
					margin-right: 16rpx;
					padding: 4rpx 12rpx;
					font-size: 24rpx;
					color: rgba(52, 49, 79, 0.8);
					line-height: 32rpx;
					border-radius: 8rpx;
					background-color: #F4F4F4;
					box-sizing: border-box;
				}
			}
			.jobfair-info {
				.info {
					position: relative;
					display: block;
					font-weight: 400;
					padding-left: 36rpx;
					font-size: 26rpx;
					color: rgba(52, 49, 79, 0.7);
					line-height: 16px;
					text-align: left;
					font-style: normal;
					display: block;
					margin-bottom: 12rpx;
					box-sizing: border-box;
					
					&::before {
						position: absolute;
						top: 0;
						left: 0;
						display: block;
						width: 32rpx;
						height: 32rpx;
						content: '';
					}
					&.address::before {
						background: url('https://hxs.dsjhs.com:553/prod-api/profile/wz-icon.png') no-repeat center;
						background-size: 100% 100%;
					}
					&.date::before {
						background: url('https://hxs.dsjhs.com:553/prod-api/profile/sj-icon.png') no-repeat center;
						background-size: 100% 100%;
					}
				}
			}
			.jobfair-statu {
				position: absolute;
				bottom: 32rpx;
				right: 32rpx;
				font-weight: 400;
				font-size: 26rpx;
				ccolor: #34314F;
				line-height: 32rpx;
				text-align: center;
				&.hot {
					color: #FF7F1C !important;
				}
				&.start {
					color: #0066FD !important;
				}
				&.end {
					color: rgba(52, 49, 79, 0.40) !important;
				}
			}
		}
	}
</style>